//购物车控制层
app.controller('cartController',function($scope,$controller,userLoginService,cartService){
	//继承控制器
	$controller("commonController",{$scope,$scope});
	//查询购物车列表
	$scope.findCartList=function(){
		cartService.findCartList().success(
			function(response){
				$scope.cartList=response;
				$scope.totalValue= cartService.sum($scope.cartList);
			}
		);
	}
	
	//数量加减
	$scope.addGoodsToCartList=function(itemId,num){
		cartService.addGoodsToCartList(itemId,num).success(
			function(response){
				if(200==response.code){//如果成功
					//刷新列表
					$scope.findCartList();
				}else{
					alert(response.message);
				}				
			}		
		);		
	}
});